package de.game.level;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.image.BufferedImage;

import de.core.gameplay.actor.misc.FPSLabel;
import de.core.gameplay.actor.misc.button.Button;
import de.core.gameplay.level.AbstractLevel;
import de.core.utils.ImageUtils;
import de.game.actor.creep.spawn.Spawn;
import de.game.actor.tower.TestTower;

public class TestLevel extends AbstractLevel {

    public TestLevel() {
        super(createImage(), 800, 600);

        addActor(new TestTower(300, 100));
        addActor(new Button(createColoredButtonImage(new Color(100, 100, 100)),
                            createColoredButtonImage(new Color(50, 33, 200)),
                            createColoredButtonImage(new Color(63, 127, 255)), 90, 90));
        addActor(new FPSLabel(new Color(63, 127, 255), 50, 50));
        addActor(new Spawn());
    }

    protected static BufferedImage createImage() {
        BufferedImage image = ImageUtils.createCompatibleImage(800, 600);
        Graphics graphics = image.getGraphics();
        graphics.setColor(new Color(33, 33, 33));
        graphics.fillRect(0, 0, 800, 600);
        graphics.dispose();
        return image;
    }

    private static BufferedImage createColoredButtonImage(Color aColor) {
        BufferedImage image = ImageUtils.createCompatibleImage(32, 16);
        Graphics graphics = image.getGraphics();
        graphics.setColor(aColor);
        graphics.fillRect(0, 0, 32, 16);
        graphics.dispose();
        return image;
    }
}
